package dk.hewison.client;

import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.Widget;
import dk.hewison.client.domain.Directory;
import dk.hewison.client.mvc.PageView;

/**
 * @author John Hewison
 * @author $LastChangedBy: john.hewison $:  $ $LastChangedDate: 2009-02-09 12:39:39 +0000 (Mon, 09 Feb 2009) $:
 * @version $Revision: 363 $:
 */
public class MediaAppView extends PageView<Directory> {

    private static final int MENU_HEIGHT = 30;
    private Widget menu;


    public void initView() {
        menu = controller.getSubView(MediaAppController.MAIN_MENU_ID).getMyWidget();
        Widget pageStack = controller.getSubView(MediaAppController.PAGE_STACK).getMyWidget();

        //dockPanel.add(menu, DockPanel.NORTH);
        dockPanel.add(pageStack, DockPanel.CENTER);

        dockPanel.setSize("100%", "100%");

        //dockPanel.setCellHeight(menu, MENU_HEIGHT + "px");
        //setCellWidth(pageStackView, "100%");

        //Window.addWindowResizeListener(this);

        DeferredCommand.addCommand(new Command() {
            public void execute() {
                //onWindowResized(Window.getClientWidth(), Window.getClientHeight());
            }
        });
    }

    public Directory getModel() {
        return null;
    }

    public void setModel(Directory model) {

    }

    public void showMenu(boolean b) {
        /*if (menu.isAttached() == b) return;

        if (b) {
            dockPanel.add(menu, DockPanel.NORTH);
            dockPanel.setCellHeight(menu, MENU_HEIGHT + "px");
        } else {
            dockPanel.remove(menu);
        }
        menu.setVisible(b);*/
    }
}
